package com.neulogistics.contrib.usercenter.api.application.converter;

import com.neulogistics.contrib.usercenter.api.application.query.UserQuery;
import com.neulogistics.contrib.usercenter.infrastructure.persistence.orm.po.UserPO;
import org.springframework.beans.BeanUtils;

public class UserQueryPOConverter {
    public static UserPO queryToPO(UserQuery userQuery){
        if(userQuery == null)
            return null;

        UserPO userPO = new UserPO();
        BeanUtils.copyProperties(userQuery, userPO);
        if(userQuery.userRole == -1){
            userPO.setUserRole(null);
        }

        return userPO;
    }
}
